#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->tabWidget->setCurrentIndex(0);
    price_model = new QSqlTableModel(this);
    price_model->setTable("roomtype");
    price_model->select();
    price_model->removeColumn(price_model->fieldIndex("tid"));
    price_model->removeColumn(price_model->fieldIndex("amount"));

    price_model->setHeaderData(0,Qt::Horizontal , tr("房间类型"));
    price_model->setHeaderData(1,Qt::Horizontal , tr("价格"));
    price_model->setHeaderData(2,Qt::Horizontal , tr("押金"));
    price_model->setHeaderData(3,Qt::Horizontal , tr("描述"));
    ui->table_root_type->setModel(this->price_model);

    roominfo_model = new QSqlTableModel(this);
    roominfo_model->setTable("room");
    roominfo_model->select();
    ui->table_rom_select->setModel(this->roominfo_model);
}

MainWindow::~MainWindow()
{
    delete ui;
}
